package cinescope2014.boundaries;

import cinescope2014.daos.Connexion;
import cinescope2014.utilities.Globale;
import java.beans.PropertyVetoException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;

/**
 *
 * @author pascal
 */
public class MDI extends javax.swing.JFrame {

    private Connection icn;
    // Pour du Singleton
    private JDialogAPropos jda;

    /**
     * Creates new form MDI
     */
    public MDI() {
        initComponents();

//        new JDialogAuthentification(this, true);
        try {
//                Class.forName("org.gjt.mm.mysql.Driver");
//                String lsDSN = "jdbc:mysql://127.0.0.1:3306/cinescope2014";
//                Connection lcn = DriverManager.getConnection(lsDSN, "root", "");
//                lcn.setAutoCommit(false);

            // getConnexion(String asServeur, String asBD, String asPort, String asUT, String asMDP) {
            Connection lcn;
            lcn = Connexion.getConnexionMySQL("127.0.0.1", "cinescope2014", "3306", "root", "");
//            lcn = Connexion.getConnexion("172.26.10.6", "cinescope2014", "3307", "p", "b");
            Globale.setConnexion(lcn);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }

        icn = Globale.getConnexion();
        Globale.setMdi(this);

        setTitle("BACK-OFFICE CineScope2014");
        setSize(800, 600);

        setLocationRelativeTo(null);

//        paysInsertMenuItemActionPerformed(null);
//        paysDeleteMenuItemActionPerformed(null);
//        paysUpdateMenuItemActionPerformed(null);
//        paysSelectMenuItemActionPerformed(null);
//        genresCRUDMenuItemActionPerformed(null); 
//        rubriquesCRUDMenuItemActionPerformed(null);
//        departementsCRUDMenuItemActionPerformed(null);
//        villesCRUDMenuItemActionPerformed(null);        
//        arrondissementsCRUDMenuItemActionPerformed(null);
        mediaCRUDMenuItemActionPerformed(null);
//        journalistesMenuItemActionPerformed(null);
//        articlesCRUDMenuItemActionPerformed(null);
//        apprecierCRUDMenuItemActionPerformed(null);
//        appreciationCRUDMenuItemActionPerformed(null);
//        cinemasAjoutMenuItemActionPerformed(null);
        
//        filmsInsertMenuItemActionPerformed(null);
        
//        generiqueCRUDMenuItemActionPerformed(null);

        this.setExtendedState(javax.swing.JFrame.MAXIMIZED_BOTH);
        
        setVisible(true);

    } /// CONSTRUCTEUR

    /**
     *
     * @param jif
     */
    private void ouvrirJIF(JInternalFrame jif) {
        //JIFPaysInsert jif = new JIFPaysInsert();
        this.desktopPane.add(jif);
        // La met au premier plan en plein ecran
//        try {
//            jif.setMaximum(true);
//            jif.setSelected(true);
////            cascadeMenuItemActionPerformed(null);
//        } catch (PropertyVetoException ex) {
//            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
//        }
    } /// ouvrirJIF

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        desktopPane = new javax.swing.JDesktopPane();
        menuBar = new javax.swing.JMenuBar();
        fichierMenu = new javax.swing.JMenu();
        authentificationMenuItem = new javax.swing.JMenuItem();
        deconnexionMenuItem = new javax.swing.JMenuItem();
        jSeparator4 = new javax.swing.JPopupMenu.Separator();
        quitterMenuItem = new javax.swing.JMenuItem();
        CRUDMenu = new javax.swing.JMenu();
        paysInsertMenuItem = new javax.swing.JMenuItem();
        paysDeleteMenuItem = new javax.swing.JMenuItem();
        paysSelectMenuItem = new javax.swing.JMenuItem();
        paysUpdateMenuItem = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JPopupMenu.Separator();
        arrondissementsCRUDMenuItem = new javax.swing.JMenuItem();
        departementsCRUDMenuItem = new javax.swing.JMenuItem();
        villesCRUDMenuItem = new javax.swing.JMenuItem();
        jSeparator8 = new javax.swing.JPopupMenu.Separator();
        genresCRUDMenuItem = new javax.swing.JMenuItem();
        rubriquesCRUDMenuItem = new javax.swing.JMenuItem();
        jSeparator6 = new javax.swing.JPopupMenu.Separator();
        mediaCRUDMenuItem = new javax.swing.JMenuItem();
        appreciationCRUDMenuItem = new javax.swing.JMenuItem();
        journalistesMenuItem = new javax.swing.JMenuItem();
        jSeparator5 = new javax.swing.JPopupMenu.Separator();
        cinemasAjoutMenuItem = new javax.swing.JMenuItem();
        jSeparator7 = new javax.swing.JPopupMenu.Separator();
        generiqueCRUDMenuItem = new javax.swing.JMenuItem();
        jMenuChaqueSemauine = new javax.swing.JMenu();
        articlesCRUDMenuItem = new javax.swing.JMenuItem();
        apprecierCRUDMenuItem = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        filmsInsertMenuItem = new javax.swing.JMenuItem();
        fenetreMenu = new javax.swing.JMenu();
        cascadeMenuItem = new javax.swing.JMenuItem();
        horizonaleMenuItem = new javax.swing.JMenuItem();
        verticaleMenuItem = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        fermerMenuItem = new javax.swing.JMenuItem();
        fermerToutMenuItem = new javax.swing.JMenuItem();
        aideMenu = new javax.swing.JMenu();
        contenuMenuItem = new javax.swing.JMenuItem();
        AProposMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        fichierMenu.setMnemonic('f');
        fichierMenu.setText("Fichier");

        authentificationMenuItem.setMnemonic('a');
        authentificationMenuItem.setText("S'authentifier");
        authentificationMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                authentificationMenuItemActionPerformed(evt);
            }
        });
        fichierMenu.add(authentificationMenuItem);

        deconnexionMenuItem.setMnemonic('d');
        deconnexionMenuItem.setText("Se déconnecter");
        fichierMenu.add(deconnexionMenuItem);
        fichierMenu.add(jSeparator4);

        quitterMenuItem.setMnemonic('q');
        quitterMenuItem.setText("Quitter");
        quitterMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                quitterMenuItemActionPerformed(evt);
            }
        });
        fichierMenu.add(quitterMenuItem);

        menuBar.add(fichierMenu);

        CRUDMenu.setMnemonic('c');
        CRUDMenu.setText("CRUD");

        paysInsertMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        paysInsertMenuItem.setMnemonic('a');
        paysInsertMenuItem.setText("Pays (Ajout)");
        paysInsertMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                paysInsertMenuItemActionPerformed(evt);
            }
        });
        CRUDMenu.add(paysInsertMenuItem);

        paysDeleteMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        paysDeleteMenuItem.setMnemonic('s');
        paysDeleteMenuItem.setText("Pays (Suppression)");
        paysDeleteMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                paysDeleteMenuItemActionPerformed(evt);
            }
        });
        CRUDMenu.add(paysDeleteMenuItem);

        paysSelectMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        paysSelectMenuItem.setMnemonic('v');
        paysSelectMenuItem.setText("Pays (Visualisation)");
        paysSelectMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                paysSelectMenuItemActionPerformed(evt);
            }
        });
        CRUDMenu.add(paysSelectMenuItem);

        paysUpdateMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        paysUpdateMenuItem.setMnemonic('m');
        paysUpdateMenuItem.setText("Pays (Modification)");
        paysUpdateMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                paysUpdateMenuItemActionPerformed(evt);
            }
        });
        CRUDMenu.add(paysUpdateMenuItem);
        CRUDMenu.add(jSeparator3);

        arrondissementsCRUDMenuItem.setText("Arrondissements CRUD");
        arrondissementsCRUDMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                arrondissementsCRUDMenuItemActionPerformed(evt);
            }
        });
        CRUDMenu.add(arrondissementsCRUDMenuItem);

        departementsCRUDMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        departementsCRUDMenuItem.setMnemonic('u');
        departementsCRUDMenuItem.setText("Départements CRUD");
        departementsCRUDMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                departementsCRUDMenuItemActionPerformed(evt);
            }
        });
        CRUDMenu.add(departementsCRUDMenuItem);

        villesCRUDMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        villesCRUDMenuItem.setMnemonic('p');
        villesCRUDMenuItem.setText("Villes CRUD");
        villesCRUDMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                villesCRUDMenuItemActionPerformed(evt);
            }
        });
        CRUDMenu.add(villesCRUDMenuItem);
        CRUDMenu.add(jSeparator8);

        genresCRUDMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        genresCRUDMenuItem.setMnemonic('l');
        genresCRUDMenuItem.setText("Genres CRUD");
        genresCRUDMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                genresCRUDMenuItemActionPerformed(evt);
            }
        });
        CRUDMenu.add(genresCRUDMenuItem);

        rubriquesCRUDMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        rubriquesCRUDMenuItem.setMnemonic('t');
        rubriquesCRUDMenuItem.setText("Rubriques CRUD");
        rubriquesCRUDMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rubriquesCRUDMenuItemActionPerformed(evt);
            }
        });
        CRUDMenu.add(rubriquesCRUDMenuItem);
        CRUDMenu.add(jSeparator6);

        mediaCRUDMenuItem.setText("Media (CRUD)");
        mediaCRUDMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mediaCRUDMenuItemActionPerformed(evt);
            }
        });
        CRUDMenu.add(mediaCRUDMenuItem);

        appreciationCRUDMenuItem.setText("Appréciation (CRUD)");
        appreciationCRUDMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                appreciationCRUDMenuItemActionPerformed(evt);
            }
        });
        CRUDMenu.add(appreciationCRUDMenuItem);

        journalistesMenuItem.setText("Journalistes (CRUD)");
        journalistesMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                journalistesMenuItemActionPerformed(evt);
            }
        });
        CRUDMenu.add(journalistesMenuItem);
        CRUDMenu.add(jSeparator5);

        cinemasAjoutMenuItem.setText("Cinémas (Ajout)");
        cinemasAjoutMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cinemasAjoutMenuItemActionPerformed(evt);
            }
        });
        CRUDMenu.add(cinemasAjoutMenuItem);
        CRUDMenu.add(jSeparator7);

        generiqueCRUDMenuItem.setText("Générique (CRUD)");
        generiqueCRUDMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                generiqueCRUDMenuItemActionPerformed(evt);
            }
        });
        CRUDMenu.add(generiqueCRUDMenuItem);

        menuBar.add(CRUDMenu);

        jMenuChaqueSemauine.setText("Chaque semaine");

        articlesCRUDMenuItem.setText("Articles (CRUD)");
        articlesCRUDMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                articlesCRUDMenuItemActionPerformed(evt);
            }
        });
        jMenuChaqueSemauine.add(articlesCRUDMenuItem);

        apprecierCRUDMenuItem.setText("Apprécier (CRUD)");
        apprecierCRUDMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                apprecierCRUDMenuItemActionPerformed(evt);
            }
        });
        jMenuChaqueSemauine.add(apprecierCRUDMenuItem);
        jMenuChaqueSemauine.add(jSeparator2);

        filmsInsertMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        filmsInsertMenuItem.setMnemonic('o');
        filmsInsertMenuItem.setText("Films (Ajout)");
        filmsInsertMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                filmsInsertMenuItemActionPerformed(evt);
            }
        });
        jMenuChaqueSemauine.add(filmsInsertMenuItem);

        menuBar.add(jMenuChaqueSemauine);

        fenetreMenu.setMnemonic('f');
        fenetreMenu.setText("Fenêtre");

        cascadeMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK));
        cascadeMenuItem.setMnemonic('c');
        cascadeMenuItem.setText("Cascade");
        cascadeMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cascadeMenuItemActionPerformed(evt);
            }
        });
        fenetreMenu.add(cascadeMenuItem);

        horizonaleMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.ALT_MASK));
        horizonaleMenuItem.setMnemonic('h');
        horizonaleMenuItem.setText("Horizontale");
        horizonaleMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                horizonaleMenuItemActionPerformed(evt);
            }
        });
        fenetreMenu.add(horizonaleMenuItem);

        verticaleMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.ALT_MASK));
        verticaleMenuItem.setMnemonic('v');
        verticaleMenuItem.setText("Verticale");
        verticaleMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                verticaleMenuItemActionPerformed(evt);
            }
        });
        fenetreMenu.add(verticaleMenuItem);
        fenetreMenu.add(jSeparator1);

        fermerMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.ALT_MASK));
        fermerMenuItem.setMnemonic('f');
        fermerMenuItem.setText("Fermer");
        fermerMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fermerMenuItemActionPerformed(evt);
            }
        });
        fenetreMenu.add(fermerMenuItem);

        fermerToutMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_MASK));
        fermerToutMenuItem.setMnemonic('t');
        fermerToutMenuItem.setText("Fermer tout");
        fermerToutMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fermerToutMenuItemActionPerformed(evt);
            }
        });
        fenetreMenu.add(fermerToutMenuItem);

        menuBar.add(fenetreMenu);

        aideMenu.setMnemonic('a');
        aideMenu.setText("Aide");

        contenuMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.ALT_MASK));
        contenuMenuItem.setMnemonic('c');
        contenuMenuItem.setText("Contenu");
        aideMenu.add(contenuMenuItem);

        AProposMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK));
        AProposMenuItem.setMnemonic('a');
        AProposMenuItem.setText("A propos");
        AProposMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AProposMenuItemActionPerformed(evt);
            }
        });
        aideMenu.add(AProposMenuItem);

        menuBar.add(aideMenu);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 279, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void quitterMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_quitterMenuItemActionPerformed
        System.exit(0);
    }//GEN-LAST:event_quitterMenuItemActionPerformed

    private void paysInsertMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_paysInsertMenuItemActionPerformed
        JIFPaysInsert jif = new JIFPaysInsert();
        ouvrirJIF(jif);
        //ouvrirJIF(new JIFPaysInsert());
        try {
            jif.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }//GEN-LAST:event_paysInsertMenuItemActionPerformed

    private void paysDeleteMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_paysDeleteMenuItemActionPerformed
        JIFPaysDelete jif = new JIFPaysDelete();
        ouvrirJIF(jif);
        try {
            jif.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }//GEN-LAST:event_paysDeleteMenuItemActionPerformed

    private void paysSelectMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_paysSelectMenuItemActionPerformed
        JIFPaysSelect jif = new JIFPaysSelect();
        ouvrirJIF(jif);
        try {
            jif.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }//GEN-LAST:event_paysSelectMenuItemActionPerformed

    private void paysUpdateMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_paysUpdateMenuItemActionPerformed
        JIFPaysUpdate jif = new JIFPaysUpdate();
        ouvrirJIF(jif);
        try {
            jif.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }//GEN-LAST:event_paysUpdateMenuItemActionPerformed

    private void departementsCRUDMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_departementsCRUDMenuItemActionPerformed
        JIFDepartementCRUD jif = new JIFDepartementCRUD();
        ouvrirJIF(jif);
        try {
            jif.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }//GEN-LAST:event_departementsCRUDMenuItemActionPerformed

    private void fermerToutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fermerToutMenuItemActionPerformed
        JDesktopPane jdpBureau = this.desktopPane;

        JInternalFrame[] tFrames = jdpBureau.getAllFrames();
        try {
            for (int i = 0; i < tFrames.length; ++i) {
                tFrames[i].setClosed(true);
            }
        } catch (PropertyVetoException e) {
        }
    }//GEN-LAST:event_fermerToutMenuItemActionPerformed

    private void fermerMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fermerMenuItemActionPerformed
        JDesktopPane jdpBureau = this.desktopPane;
        JInternalFrame[] tFrames = jdpBureau.getAllFrames();
        try {
            if (tFrames.length > 0) {
                tFrames[0].setClosed(true);
            }
        } catch (PropertyVetoException e) {
        }
    }//GEN-LAST:event_fermerMenuItemActionPerformed

    private void horizonaleMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_horizonaleMenuItemActionPerformed
        JDesktopPane jdpBureau = this.desktopPane;

        JInternalFrame[] tFrames = jdpBureau.getAllFrames();

        try {
            int ly = 0;

            int liLargeurBureau = jdpBureau.getWidth();
            int liHauteurBureau = jdpBureau.getHeight();
            int liHauteur = liHauteurBureau / tFrames.length;

            for (int i = tFrames.length - 1; i >= 0; i--) {
                tFrames[i].setBounds(0, ly, liLargeurBureau, liHauteur);
                ly += liHauteur;
            }

        } catch (Exception e) {
        }
    }//GEN-LAST:event_horizonaleMenuItemActionPerformed

    private void verticaleMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_verticaleMenuItemActionPerformed
        JDesktopPane jdpBureau = this.desktopPane;

        JInternalFrame[] tFrames = jdpBureau.getAllFrames();
        try {
            int lx = 0;

            int liLargeurBureau = jdpBureau.getWidth();
            int liHauteurBureau = jdpBureau.getHeight();
            int liLargeur = liLargeurBureau / tFrames.length;

            for (int i = tFrames.length - 1; i >= 0; i--) {
                tFrames[i].setBounds(lx, 0, liLargeur, liHauteurBureau);
                lx += liLargeur;
            }

        } catch (Exception e) {
        }
    }//GEN-LAST:event_verticaleMenuItemActionPerformed

    private void cascadeMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cascadeMenuItemActionPerformed
        JDesktopPane jdpBureau = this.desktopPane;

        JInternalFrame[] tFrames = jdpBureau.getAllFrames();
        try {
            int lx = 0, ly = 0;

            for (int i = tFrames.length - 1; i >= 0; i--) {
                // Arbitrairement a 500 sur 300
                tFrames[i].setBounds(lx, ly, 500, 300);
                lx += 30;
                ly += 30;
            }

        } catch (Exception e) {
        }
    }//GEN-LAST:event_cascadeMenuItemActionPerformed

    private void AProposMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AProposMenuItemActionPerformed
        jda = new JDialogAPropos(this, false);
    }//GEN-LAST:event_AProposMenuItemActionPerformed

    private void villesCRUDMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_villesCRUDMenuItemActionPerformed
        //
        JIFVilleCRUD jif = new JIFVilleCRUD();
        ouvrirJIF(jif);
        try {
            jif.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }//GEN-LAST:event_villesCRUDMenuItemActionPerformed

    private void filmsInsertMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filmsInsertMenuItemActionPerformed
        //
        JIFFilmNouveau jif = new JIFFilmNouveau();
        ouvrirJIF(jif);
        try {
            jif.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }//GEN-LAST:event_filmsInsertMenuItemActionPerformed

    private void genresCRUDMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_genresCRUDMenuItemActionPerformed
        //
        JIFGenreCRUD jif = new JIFGenreCRUD();
        ouvrirJIF(jif);
        try {
            jif.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }//GEN-LAST:event_genresCRUDMenuItemActionPerformed

    private void rubriquesCRUDMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rubriquesCRUDMenuItemActionPerformed
        //
        JIFRubriqueCRUD jif = new JIFRubriqueCRUD();
        ouvrirJIF(jif);
        try {
            jif.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }//GEN-LAST:event_rubriquesCRUDMenuItemActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        //
        try {
            icn.close();
        } catch (SQLException e) {
            System.out.println(e.getMessage());
        }

    }//GEN-LAST:event_formWindowClosing

    private void authentificationMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_authentificationMenuItemActionPerformed
        //
        new JDialogAuthentification(this, true);
    }//GEN-LAST:event_authentificationMenuItemActionPerformed

    private void arrondissementsCRUDMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_arrondissementsCRUDMenuItemActionPerformed
        //
        JIFArrondissementCRUD jif = new JIFArrondissementCRUD();
        ouvrirJIF(jif);
        try {
            jif.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
        }        

    }//GEN-LAST:event_arrondissementsCRUDMenuItemActionPerformed

    private void mediaCRUDMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mediaCRUDMenuItemActionPerformed
        //
        JIFMediaCRUD jif = new JIFMediaCRUD();
        ouvrirJIF(jif);
        try {
            jif.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_mediaCRUDMenuItemActionPerformed

    private void appreciationCRUDMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_appreciationCRUDMenuItemActionPerformed
        //
        JIFAppreciationCRUD jif = new JIFAppreciationCRUD();
        ouvrirJIF(jif);
        try {
            jif.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }//GEN-LAST:event_appreciationCRUDMenuItemActionPerformed

    private void journalistesMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_journalistesMenuItemActionPerformed
        //
        JIFJournalisteCRUD jif = new JIFJournalisteCRUD();
        ouvrirJIF(jif);
        try {
            jif.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }//GEN-LAST:event_journalistesMenuItemActionPerformed

    private void articlesCRUDMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_articlesCRUDMenuItemActionPerformed
        //
        JIFArticleCRUD jif = new JIFArticleCRUD();
        ouvrirJIF(jif);
        try {
            jif.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }//GEN-LAST:event_articlesCRUDMenuItemActionPerformed

    private void apprecierCRUDMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_apprecierCRUDMenuItemActionPerformed
        //
        JIFApprecierCRUD jif = new JIFApprecierCRUD();
        ouvrirJIF(jif);
        try {
            jif.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }//GEN-LAST:event_apprecierCRUDMenuItemActionPerformed

    private void cinemasAjoutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cinemasAjoutMenuItemActionPerformed
        // 
        JIFCinemaAjout jif = new JIFCinemaAjout();
        ouvrirJIF(jif);
        try {
            jif.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }//GEN-LAST:event_cinemasAjoutMenuItemActionPerformed

    private void generiqueCRUDMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generiqueCRUDMenuItemActionPerformed
        // 
        JIFGenerique jif = new JIFGenerique("appreciation");
        ouvrirJIF(jif);  
        try {
            jif.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(MDI.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }//GEN-LAST:event_generiqueCRUDMenuItemActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MDI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MDI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MDI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MDI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MDI().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem AProposMenuItem;
    private javax.swing.JMenu CRUDMenu;
    private javax.swing.JMenu aideMenu;
    private javax.swing.JMenuItem appreciationCRUDMenuItem;
    private javax.swing.JMenuItem apprecierCRUDMenuItem;
    private javax.swing.JMenuItem arrondissementsCRUDMenuItem;
    private javax.swing.JMenuItem articlesCRUDMenuItem;
    private javax.swing.JMenuItem authentificationMenuItem;
    private javax.swing.JMenuItem cascadeMenuItem;
    private javax.swing.JMenuItem cinemasAjoutMenuItem;
    private javax.swing.JMenuItem contenuMenuItem;
    private javax.swing.JMenuItem deconnexionMenuItem;
    private javax.swing.JMenuItem departementsCRUDMenuItem;
    private javax.swing.JDesktopPane desktopPane;
    private javax.swing.JMenu fenetreMenu;
    private javax.swing.JMenuItem fermerMenuItem;
    private javax.swing.JMenuItem fermerToutMenuItem;
    private javax.swing.JMenu fichierMenu;
    private javax.swing.JMenuItem filmsInsertMenuItem;
    private javax.swing.JMenuItem generiqueCRUDMenuItem;
    private javax.swing.JMenuItem genresCRUDMenuItem;
    private javax.swing.JMenuItem horizonaleMenuItem;
    private javax.swing.JMenu jMenuChaqueSemauine;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JPopupMenu.Separator jSeparator3;
    private javax.swing.JPopupMenu.Separator jSeparator4;
    private javax.swing.JPopupMenu.Separator jSeparator5;
    private javax.swing.JPopupMenu.Separator jSeparator6;
    private javax.swing.JPopupMenu.Separator jSeparator7;
    private javax.swing.JPopupMenu.Separator jSeparator8;
    private javax.swing.JMenuItem journalistesMenuItem;
    private javax.swing.JMenuItem mediaCRUDMenuItem;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenuItem paysDeleteMenuItem;
    private javax.swing.JMenuItem paysInsertMenuItem;
    private javax.swing.JMenuItem paysSelectMenuItem;
    private javax.swing.JMenuItem paysUpdateMenuItem;
    private javax.swing.JMenuItem quitterMenuItem;
    private javax.swing.JMenuItem rubriquesCRUDMenuItem;
    private javax.swing.JMenuItem verticaleMenuItem;
    private javax.swing.JMenuItem villesCRUDMenuItem;
    // End of variables declaration//GEN-END:variables

}
